﻿using System;
using System.Collections;
using System.Configuration;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SimplePMT.Components;
using SimplePMT.Data;
using NHibernate.Expression;

namespace SimplePMT
{
    public partial class History : Components.BasePage
    {
        public string taskHistory = string.Empty;
        public int memberId = 0;
        public List<string> memberOptions;

        protected void Page_Load(object sender, EventArgs e)
        {
            memberOptions = BuildMemberList();
            memberId = Convert.ToInt32(Session["MemberID"]);
            AjaxPro.Utility.RegisterTypeForAjax(typeof(Ajax.Home), this.Page);
            ValidateSession();
            taskHistory = Ajax.Home.GetTaskHistory(memberId);
        }

        private List<string> BuildMemberList()
        {
            Member[] members = Member.FindAll(Order.Asc("LastName"), Expression.Eq("ReadOnly", false));
            //string[] memberList = new string[members.Length + 1];
            List<string> memberList = new List<string>();
            memberList.Add("0=");
            foreach (Member member in members)
            {
                if (!member.Terminated)
                {
                    memberList.Add(member.ID + "=" + member.FirstName + " " + member.LastName);
                }
            }
            return memberList;
        }
    }
}
